import 'package:fcsjgromoreads/f_csj_gromore_ads.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';

void main() async{
  WidgetsFlutterBinding.ensureInitialized();
  await FCsjGroMoreAds.instance.requestAndroidPermissionIfNecessary();
  await FCsjGroMoreAds.instance.initCsjAd(appId: '5001121');
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            MaterialButton(onPressed: ()=>loadAd(),child: Text('加载广告'),color: Colors.blue,)
          ],
        ),
      ),
    );
  }

  loadAd() {
    FCsjGroMoreAds.instance.showRewardAd(mMediaId: '945700410');
  }
}
